package lesson4;

public class Demo1 {
    public static void main(String[] args) {
        Person person = new Person("张三",20);
        //System.out.println(person.getInfo());
        //System.out.println(person);

//        Student student1 = new Student();
//        Student student2 = new Student();
//        MyClass myClass = new MyClass();
//        boolean flag = student1.equals(student2);
        Student student3 = new Student();
        MyClass myClass = new MyClass();
        boolean flag = student3.equals(myClass);
        fun(student3);

        Student student = new Student("张三",20,"101");
        System.out.println(student);
    }

    //在引用类型中，如果是同一类型 instanceof返回为真，可以强制转换
    public static void fun(Object o){
        if(o instanceof MyClass){
            MyClass myClass = (MyClass) o;
        }else{
            System.out.println("类型不匹配，不能强转...");
        }
        //
    }
}
